} else if source_id.is_path() {
let path = source_id.url().to_file_path().ok()
.expect("path sources must have a valid path");
+ let mut src = PathSource::new(&path, source_id, config);
+ try!(src.update().chain_error(|| {
+ human(format!("`{}` is not a crate root; specify a crate to \
+ install from crates.io, or use --path or --git to \
+ specify an alternate source", path.display()))
+ }));
try!(select_pkg(PathSource::new(&path, source_id, config),
source_id, krate, vers,
- &mut |path| path.read_packages())
- .chain_error(|| human(format!("`{}` is not a crate root; specify a \
- crate to install from crates.io, or \
- use --path or --git to specify an \
- alternate source", path.display()))))
+ &mut |path| path.read_packages()))
} else {
try!(select_pkg(RegistrySource::new(source_id, config),
source_id, krate, vers,
test!(no_crate {
assert_that(cargo_process("install"),
execs().with_status(101).with_stderr("\
-Could not find Cargo.toml in `[..]`
+`[..]` is not a crate root; specify a crate to install [..]
+
+Caused by:
+ Could not find Cargo.toml in `[..]`
"));
});